from django.db import models
from meiduo_mall.utils.models import BaseModel

class OAuthQQUser(BaseModel):
    """
    QQ登录用户数据  用于记录哪个qq用户绑定了哪个美多商城用户
    """
    # qq用户  与'users.User'没多用户关联,  on_delete表示外键关联到作者表,当作者表删除了该条数据,
    # 图书表中不删除,仅仅是把外键置空
    user = models.ForeignKey('users.User', on_delete=models.CASCADE, verbose_name='用户')
    # opin是qq注册后发放的用户身份唯一标识
    openid = models.CharField(max_length=64, verbose_name='openid', db_index=True)

    class Meta:
        db_table = 'tb_oauth_qq'
        verbose_name = 'QQ登录用户数据'
        verbose_name_plural = verbose_name